<template>
  <!-- AI助手按钮组件 -->
  <div class="ai-chat-button" @click="goToAIChat">
    <img :src="aiButtonImage" alt="AI助手" class="ai-button-image" />
    <span class="ai-tooltip">AI助手</span>
  </div>
</template>

<script>
/**
 * AI助手按钮组件
 * 提供一个固定位置的悬浮按钮，点击后跳转到AI聊天页面
 */
export default {
  name: 'AIChatButton',
  data() {
    return {
      // AI助手按钮图片地址
      aiButtonImage: 'https://aaan.oss-cn-beijing.aliyuncs.com/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_2024-11-21_141916_917.png'
    }
  },
  methods: {
    /**
     * 跳转到AI聊天页面
     */
    goToAIChat() {
      this.$router.push('/ai-chat')
    }
  }
}
</script>

<style scoped>
/* AI助手按钮容器样式 */
.ai-chat-button {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  z-index: 1000;
  overflow: hidden;
  background-color: transparent;
}

/* 鼠标悬停效果 */
.ai-chat-button:hover {
  transform: scale(1.1);
}

/* 鼠标悬停时显示提示文本 */
.ai-chat-button:hover .ai-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* AI助手按钮图片样式 */
.ai-button-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* 提示文本样式 */
.ai-tooltip {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background-color: #333;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  white-space: nowrap;
}

/* 提示文本箭头样式 */
.ai-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .ai-chat-button {
    width: 56px;
    height: 56px;
    right: 20px;
    bottom: 20px;
  }
}
</style> 